<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>百度云资源分享</title>
    <link rel="stylesheet" href="" media="all">
<link rel="stylesheet" href="https://unpkg.com/layui@2.6.8/dist/css/layui.css">
    <style>
        body {
            margin: 10px;
        }
        
        .demo-carousel {
            height: 200px;
            line-height: 200px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div class="layui-layout layui-layout-admin site-demo-fixed">
        <div class="layui-header header">
            <div class="layui-fluid">
                <h1 style="text-align: center;height:100px;color: white;margin-top: 10px;" class="layui-row">百度云分享</h1>

            </div>
        </div>
        <div class="layui-body">
            <table id="demo1" lay-filter="test"></table>
        </div>
    </div>


    <script src="https://unpkg.com/layui@2.6.8/dist/layui.js"></script>
    
    <script>
        layui.use('table', function() {
            var table = layui.table;

            table.render({
                elem: '#demo1',
                height: 312,
                url: 'http://www.leening.com.cn/api/portal/lists/getCategoryPostLists?category_id=8 &field=post_title,post_source,post_keywords' //数据接口
                    ,
                page: true,
                title: '用户表',
                toolbar: 'default',
                cols: [
                    [ //表头
                        {
                            field: 'post_title',
                            title: '资源名称',
                            sort: true,
                            fixed: 'left'
                        }, {
                            field: 'post_source',
                            title: '资源地址',
                        }, {
                            field: 'post_keywords',
                            title: '提取码',
                            sort: true
                        }
                    ]
                ],
                parseData: function(res) { //res 即为原始返回的数据
                    return {
                        "code": 0, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": res.data.list.length, //解析数据长度
                        "data": res.data.list //解析数据列表
                    };
                }
            });

        });
    </script>
</body>

</html>
